﻿-------- < Universal Mount macro: /script Mountz("your_ground_mount","your_flying_mount","your_underwater_mount")
local WINTERGRASP
local locale = GetLocale()
if(locale=="ruRU") then
	WINTERGRASP = "Озеро Ледяных Оков"
elseif(locale=="frFR") then
	WINTERGRASP = "Joug-d'hiver"
elseif(locale=="deDE") then
    WINTERGRASP = "Tausendwintersee"
elseif(locale=="esES") then
    WINTERGRASP = "Conquista del Invierno"
	--[[ Template for other locales
elseif(locale=="") then
	WINTERGRASP = ""
""]]--
else  WINTERGRASP = "Wintergrasp" end

function Mountz(groundmount, flyingmount, underwatermount)
    local num = GetNumCompanions("MOUNT")
    if not num or IsMounted() then
        Dismount()
        return
    end
    if CanExitVehicle() then
        VehicleExit()
        return
    end
    --SetMapToCurrentZone()
    local continent = 100--GetCurrentMapContinent()
	local wgtime = nil
    if GetWintergraspWaitTime then
        wgtime = GetWintergraspWaitTime()
    end
	local zone = GetZoneText()
	local swimablex = IsSwimming()
    local flyablex = (IsFlyableArea() and continent > 2) or (GetZoneText() == WINTERGRASP and GetWintergraspWaitTime())

    if IsShiftKeyDown() then
        flyablex = not flyablex
    end

	if IsAltKeyDown() then
        swimablex = not swimablex
    end

    for i = 1, num, 1 do
        local _, info = GetCompanionInfo("MOUNT", i)
        if flyingmount and info == flyingmount and flyablex and not swimablex then
            CallCompanion("MOUNT", i)
            return
        elseif groundmount and info == groundmount and not flyablex and not swimablex then
            CallCompanion("MOUNT", i)
            return
		elseif underwatermount and info == underwatermount and swimablex then
			CallCompanion("MOUNT", i)
            return
        end
    end
end
